package day05;

import java.util.Arrays;

public class ArrayDemo {
    public static void main(String[] args) {
        /*int[]a=new int[4];//默认值0
        double[]b=new double[8];//默认值0.0
        boolean[]c=new boolean[56];//默认值false


        int[] arr1 = new int[8];
        int[] arr2 = {2,2,3};
        int[] arr3 = new int[]{8,9,5,2,6,};
        int[] arr4;
        arr4 = new int[]{3};

        int[] arr = new int[8];
        System.out.println("数组的长度为："+arr.length);
        System.out.println("数组的第一个元素为："+arr[0]);
        arr[0]=1;
        arr[1]=2;
        arr[2]=3;
        arr[arr.length-1]=1325614;
        System.out.println(arr[2]);
        System.out.println("数组的最后一个元素为："+arr[arr.length-1]);
         */

        /*int arr[] = new int[10];
        for (int i=0;i<arr.length;i++){
            arr[i] = (int)(Math.random()*100);
            int j=i+1;
            System.out.println("第"+j+"个数是："+arr[i]);*/

        int[] a={10,20,30,40,50};
        /*int[] b=new int[10];
        System.arraycopy(a,2,b,5,2);
        for (int i = 0;i<b.length;i++){
            System.out.println(b[i]);
        }*/
        int[] b= Arrays.copyOf(a,8);
        for (int i=0;i<b.length;i++){
            System.out.println(b[i]);
        }
    }
}
